package main

import (
	"fmt"
	"reflect"
)

// 反射练习
func testReflect(i interface{}) {
	//转为reflect。type
	rtyp := reflect.TypeOf(i)
	fmt.Printf("%v====%T", rtyp, rtyp)
	fmt.Println()

	//转为reflect.value
	rval := reflect.ValueOf(i)
	fmt.Printf("%v=====%T", rval, rval)
	fmt.Println()
	//再转为原来接口类型
	orgin := rval.Interface()
	//断言
	i3 := orgin.(float64)
	fmt.Println(i3)
	//num := 10
	i2 := rval.Float()
	//num += int(i2)
	fmt.Println(i2)

}

func main() {
	var num float64 = 1.2
	testReflect(num)

	//kind := reflect.Struct
}
